package be.ipl.eBar.daoimpl;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import be.ipl.eBar.dao.BiereDao;
import be.ipl.eBar.domaine.Biere;

@Stateless
public class BiereDaoImpl implements BiereDao{
	
	@PersistenceContext(unitName="eBar")
	private EntityManager entityManager;

	@Override
	public Biere enregistrer(Biere entite) {
		entityManager.persist(entite);
		return entite;
	}

	@Override
	public List<Biere> lister() {
		return entityManager.createQuery("SELECT * FROM BIERES", Biere.class).getResultList();
	}

}
